function addLoadEvent(func) {
    var oldonload = window.onload;//将现有的事件处理函数的值存入变量中
    if (typeof window.onload != 'function') {
        window.onload = func;//如果这个事件处理函数没有绑定任何函数，就把新函数添加给它
    } else {
        window.onload = function() {
            oldonload();
            func();//如果已经绑定了函数，就把新函数追加到现有指令的末尾
      }
    }
}

function topPicture()
	{
		var getButton=document.getElementsByClassName("topButtonsPointer");
		var k1=1,k2=0;
		var topBroad=document.getElementById("hdslideUl");	
		function topShift(){	
			var topRight=k1+'00%';
			topBroad.style.right=topRight;
			k1++;
			if(k1==3)
			k1=0;
			k2++;
			if(k2>5)
			clearInterval(flag);
		}
		var flag=setInterval(topShift,3000);
	
		for(i=0;i<getButton.length;i++)
		{
			getButton[i].index=i;
			getButton[i].onclick= function ()
			{
				clearInterval(flag);
				var topRight2=this.index+'00%';
				topBroad.style.right=topRight2;
			}
		}
}
	
addLoadEvent(topPicture);